# coding=utf-8
# author:xc
# datetime:2018/10/23 13:49

from . import api
from flask import request, render_template
from app import util

data_list = [{'id': 1, 'name': '帮助图鉴'}, {'id': 2, 'name': '定位需要注意的问题'}, {'id': 3, 'name': '定位精准问题'},
             {'id': 4, 'name': '软件使用协议'}, {'id': 5, 'name': '账号使用说明'},
             {'id': 6, 'name': '公益使用说明'}, {'id': 7, 'name': '红包使用说明'}]


@api.route('/api/news/help', methods=['POST', 'GET'])
def api_news_help():
    data = {
        'list': data_list
    }
    return util.to_json(data)


@api.route('/api/help/detail.html', methods=['Get'])
def api_news_help_detail():
    helpId = request.args.get('id')
    if int(helpId) == 1:
        return render_template('app/help1.html')
    elif int(helpId) == 2:
        return render_template('app/help2.html')
    elif int(helpId) == 3:
        return render_template('app/help3.html')
    elif int(helpId) == 4:
        return render_template('app/help4.html')
    elif int(helpId) == 5:
        return render_template('app/help5.html')
    elif int(helpId) == 6:
        return render_template('app/help6.html')
    elif int(helpId) == 7:
        return render_template('app/help7.html')


@api.route('/api/news/link', methods=['POST', 'GET'])
def api_news_link():
    return render_template('app/link.html')
